<?php
//这个是后台的首页
session_start();
//
//网站全路径
define('ROOT', $_SERVER["DOCUMENT_ROOT"].DIRECTORY_SEPARATOR);
//网站后台路径
define('ADMINROOT', $_SERVER["DOCUMENT_ROOT"].DIRECTORY_SEPARATOR.'admin'.DIRECTORY_SEPARATOR);
//初始化
require ADMINROOT.'init.php';


$request_c = $_REQUEST['c'];
$request_a = $_REQUEST['a'];

if(!empty ($request_c))
{
    if(empty ($request_a)){
        $request_a = "index";
    }
}else{
    $request_c = "default";
}

if(empty ($request_a)){
    $request_a = "index";
}

//如果模块和控制器都为空则，调用默认设置的方法
if($request_c == "default"){
    $mydefault = new login();
    if (method_exists($mydefault, $request_a)) {
        call_user_func(array($mydefault,$request_a));
    }else{
        $mydefault->defaultfunc();
        exit("function is not find!");
    }
}else{
    if(class_exists($request_c)){
        $tempclass = new $request_c;
        if(method_exists($tempclass, $request_a)){
            call_user_func(array($tempclass,$request_a));
        }
    }else{
        exit("$request_c is not find..");
    }
}
?>
